#pragma once
#include "wincriticalsection.h"
#include "def_rfc.h"

class DataQueue
{
public:
	DataQueue();
	DataQueue( int max_size = 100 );
	virtual ~ DataQueue();

protected:
	int		m_nQueueSize;
	int		m_nMaxQueueSize;
	mutable WinCriticalSection	m_cs;
	AVDATA *	m_pHead;
	AVDATA *	m_pTail;

public:
	AVDATA* Enqueue( AVDATA *pkt ); // if queue max out, pop old one
	AVDATA* Dequeue( );
	void	Flush();
	int		GetQueueSize()	{ return m_nQueueSize; }
	int		GetMaxSize() { return m_nMaxQueueSize; }
	void	SetMaxSize(int max_size ) { m_nMaxQueueSize = max_size; }
	AVDATA* GetHeader();
	AVDATA* GetTail();
};
